﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Database_Info : Form
    {
        public Database_Info()
        {
            InitializeComponent();
        }

        private void Database_Info_Load(object sender, EventArgs e)
        {
            load_db databaseinfo = new load_db();
            this.tBox_server.Text = databaseinfo.database_host;
            this.tBox_DbName.Text = databaseinfo.database_name;
            this.tBox_username.Text = databaseinfo.database_username;
            this.tBox_password.Text = databaseinfo.datbase_password;
            
                
        }

        private void buttonEdit_Click(object sender, EventArgs e)
        {
            this.tBox_DbName.ReadOnly = false;
            this.tBox_password.ReadOnly = false;
            this.tBox_server.ReadOnly = false;
            this.tBox_username.ReadOnly = false;
        }

        private void Save_Click(object sender, EventArgs e)
        {
            //No Validation Applied *Big Security Leak*
            load_db dbinfo = new load_db();
            dbinfo.database_name = this.tBox_DbName.Text.ToString();
            dbinfo.database_host = this.tBox_server.Text.ToString();
            dbinfo.database_username = this.tBox_username.Text.ToString();
            dbinfo.datbase_password = this.tBox_password.Text.ToString();
            

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
